package com.cbs.android.component.network.decoder;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.IOException;

import okhttp3.ResponseBody;

/**
 * Created by brochexu on 10/28/14.
 */
public class BitmapDecoder implements Decoder {
    public Object decode(ResponseBody body) throws IOException {
        return BitmapFactory.decodeStream(body.byteStream());
    }

    @Override
    public String desc(Object result) {
        Bitmap bitmap = (Bitmap) result;
        return String.format("bitmap: width=%d\theight=%d", bitmap.getWidth(), bitmap.getHeight());
    }
}
